package com.fool
{
	[Bindable] 
	public class SimpleCard
	{
		public var rank:uint; //0..8
		public var suit:uint; //0..3
		
		private var _isTrump:Boolean;		

		//1..18
		public function get value():uint
		{
			var result:uint = rank;
			if (isTrump)
			{
				result += 9
			}
			return (result)			
		}
		
		public function get isTrump():Boolean
		{
			return _isTrump;
		}

		public function set isTrump(value:Boolean):void
		{
			_isTrump = value;
		}


		public function SimpleCard(rank:uint, suit:uint):void
		{
			this.rank =  rank;
			this.suit = suit;
		}
		
		public function compareIsStronger(card:SimpleCard):Boolean
		{
			var result:Boolean;
			if (this.suit == card.suit)
			{
				result = this.value < card.value
			}
			else
			{
				result = (this.value < card.value && card.isTrump)				
			}
			return result;
		}
		
	}
}